#include "ByteBuffer.h"

ByteBuffer::ByteBuffer(void)
{
	this->buffer.clear();
	length = 0;
}

ByteBuffer::~ByteBuffer(void)
{
}

void ByteBuffer::put(string str)
{
	buffer.append(str);
	length += str.length();
}

void ByteBuffer::put(char* bytes, int bytesLength)
{
	buffer.append(bytes, bytesLength);
	length += bytesLength;
}

void ByteBuffer::put(int number)
{
	stringstream ss;
	ss << number;
	buffer.append(ss.str());
	length += ss.str().length();
}

const char* ByteBuffer::get(void)
{
	return buffer.c_str();
}

string ByteBuffer::getAll(void)
{
	return buffer;
}

int ByteBuffer::size(void)
{
	return length;
}

void ByteBuffer::clear(void)
{
	this->buffer.clear();
	length = 0;
}
